<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Ad extends Model
{
	use HasDateTimeFormatter;
    protected $fillable = ['user_id','goods_id', 'ads_config_id', 'amount', 'status', 'click','finish_click'];


    const NOTSTART = 0;   // 进行中
    const PROGRESS = 1;   // 成功
    const FINISH = 2;   // 失败

    const STATUS_MAP = [
        self::NOTSTART => '未开始',
        self::PROGRESS => '执行中',
        self::FINISH => '执行完成'
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }


    public function goods(): BelongsTo
    {
        return $this->belongsTo(Goods::class);
    }



}
